package fa;

import java.util.Objects;

/**
 * @author haoly
 * @title FARule
 * @date 2025/4/16 10:43
 * @description FARule
 */
public class FARule<T> {
    private final T state;

    private final Character character;

    private final  T nextState;


    public FARule(T state, Character character, T nextState) {
        this.state = state;
        this.character = character;
        this.nextState = nextState;
    }

    public Boolean appliesTo(T state, Character character){
        return Objects.equals(this.state, state) && Objects.equals(this.character, character);
    }

    public T follow(){
        return this.nextState;
    }

    public T getState() {
        return state;
    }

    public Character getCharacter() {
        return character;
    }

    public T getNextState() {
        return nextState;
    }

    @Override
    public String toString() {
        return "<FARule " + this.state + "--" + this.character + "-->" + this.nextState + ">";
    }
}
